<style type="text/css">
    .input-sm{padding:2px;}
</style>

<div class="cover">
    <div class="control control-cover">
        <div class='form-group-title'>加入领券中心</div>
        <div class="form-group user-defined">
            <label  class="col-lg control-label">是否加入</label>
            <div class="col-sm-8 col-xs-12">
                {ife 'sale.wxcard' $item}
                <label class="radio-inline">
                    <input type="radio" name="gettype" value="1" {if $item['gettype'] == 1}checked="true"{/if} onclick="$('.gettype').show()" /> 可以
                </label>
                <label class="radio-inline">
                    <input type="radio" name="gettype" value="0" {if $item['gettype'] == 0}checked="true"{/if}  onclick="$('.gettype').hide()"/> 不可以
                </label>
                {else}
                    {if $item['gettype']==1}可以{else}不可以{/if}
                {/if}
                <p class='help-block'>会员是否可以在领券中心直接领取</p>
            </div>
        </div>


        <div class="gettype" {if $item['gettype']!=1}style="display:none"{/if}>
            <div class='form-group-title'>版式控制</div>
            <div class="form-group">
                <label  class="col-lg control-label">标签文字</label>
                <div class="col-sm-8 col-xs-12">
                    {ife 'sale.wxcard' $item}
                    <input type='text' class='form-control' value="{$item['tagtitle']}" name='tagtitle' maxlength="8"/>
                    {else}
                        {$item['tagtitle']}
                    {/if}
                    <p class='help-block'>不填写则使用默认文字</p>
                </div>

            </div>
            <div class="form-group">
                <label  class="col-lg control-label">设置标签颜色</label>
                <div class="col-sm-8 col-xs-12">
                    {ife 'sale.coupon' $item}
                    <label class="radio-inline">
                        <input type="radio" name="settitlecolor" value="1" {if $item['settitlecolor'] == 1}checked="true"{/if} onclick="$('.setcolor').show()" /> 是
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="settitlecolor" value="0" {if $item['settitlecolor'] == 0}checked="true"{/if}  onclick="$('.setcolor').hide()"/> 否
                    </label>
                    {else}
                        {if $item['settitlecolor']==1}是{else}否{/if}
                    {/if}
                    <span style="display: none" class='error'>会员是否自定义领券中心标签文字的底色,如果不定义则使用默认颜色风格</span>
                </div>
            </div>
            <div class="form-group setcolor"  {if $item['settitlecolor']!=1}style="display:none"{/if}>
            <label  class="col-lg control-label">标签颜色</label>
                <div class="col-sm-8 col-xs-12">
                    {ife 'sale.coupon' $item}
                    <input  class="color" name="titlecolor" value="{$item['titlecolor']}" type="color" />
                    <span class="btn btn-default" onclick="$(this).prev().val('#000000').trigger('propertychange')">重置</span>
                    {else}
                    <span style="width:15px; background: {$item['titlecolor']}"> </span>
                    {/if}
                    <span style="display: none" class='error'>会员是否自定义领券中心标签文字的底色,如果不定义则使用默认颜色风格</span>
                </div>
            </div>

            <div class="form-group">
                <label  class="col-lg control-label">限制会员等级</label>
                <div class="col-sm-8 col-xs-12">
                    {ife 'sale.coupon' $item}
                    <label class="radio-inline">
                        <input type="radio" name="islimitlevel" value="1" {if $item['islimitlevel'] == 1}checked="true"{/if} onclick="$('.islimitlevel').show()" /> 是
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="islimitlevel" value="0" {if $item['islimitlevel'] == 0}checked="true"{/if}  onclick="$('.islimitlevel').hide()"/> 否
                    </label>
                    {else}
                        {if $item['islimit']==1}是{else}否{/if}
                    {/if}
                    <span style="display: none" class='error'>会员在领券中心直接领取或购买时是否需要达到指定的会员等级,如果不定义则使用默认颜色风格</span>
                </div>

            </div>
        </div>

        <div class="islimitlevel" {if $item['islimitlevel']!=1}style="display:none"{/if}>
            <div class='form-group-title'>限制会员等级</div>
            <div class="form-group" >
                <label  class="col-lg control-label">是否全选</label>
                <div class="col-sm-8 col-xs-12">
                    <label class="a-inline" style="line-height: 30px">
                        <a href="javascript:void(0);"  id="btnCheckAll" />全选</a>
                    </label>
                    <label class="a-inline"  style="line-height: 30px">
                        <a  href="javascript:void(0);"  id="btnCheckNone" />反选</a>
                    </label>
                </div>
            </div>

            <!--显示隐藏会员等级限制-->
            <div class="form-group" >
                <label  class="col-lg control-label">会员等级</label>
                <div class="col-sm-8 col-xs-12">
                    {ife 'sale.coupon' $item}
                        <label class="checkbox-inline"><input type="checkbox"  class="checkall" name="limitmemberlevels[]" value="0" {if !empty($limitmemberlevels)&&in_array("0",$limitmemberlevels)} checked="true"  {/if}  /> {php echo empty($shop['levelname'])?'普通等级':$shop['levelname']}</label>
                        {loop $levels $level}
                            <label class="checkbox-inline"><input type="checkbox"  class="checkall" name="limitmemberlevels[]" value="{$level['id']}"  {if !empty($limitmemberlevels)&&in_array( $level['id'] , $limitmemberlevels)} checked="true"  {/if}  /> {$level['levelname']}</label>
                        {/loop}
                    {else}
                        {if  !empty($limitmemberlevels)&&in_array("0",$limitmemberlevels)} {php echo  empty($shop['levelname'])?'普通等级':$shop['levelname']}  {/if}&nbsp;&nbsp;
                        {loop $levels $level}
                            {if   !empty($limitmemberlevels)&&in_array($level['id'] , $limitmemberlevels)}
                                {php echo $level['levelname']}&nbsp;&nbsp;
                            {/if}
                        {/loop}
                    {/if}
                </div>
            </div>

            <!--分销商等级限制-->
            {if $hascommission}
                <div class="form-group" >
                    <label  class="col-lg control-label">分销商等级</label>
                    <div class="col-sm-8 col-xs-12">
                        {ife 'sale.coupon' $item}
                            <label class="checkbox-inline"><input type="checkbox"  class="checkall" name="limitagentlevels[]" value="0" {if !empty($limitagentlevels)&&in_array("0",$limitagentlevels)} checked="true"  {/if}  /> {php echo empty($plugin_com_set['levelname'])?'普通等级':$plugin_com_set['levelname']}</label>
                            {loop $agentlevels $level}
                                <label class="checkbox-inline"><input type="checkbox"  class="checkall" name="limitagentlevels[]" value="{$level['id']}"  {if !empty($limitagentlevels)&&in_array( $level['id'] , $limitagentlevels)} checked="true"  {/if}  /> {$level['levelname']}</label>
                            {/loop}
                        {else}
                            {if !empty($limitagentlevels)&&in_array("0",$limitagentlevels)} {php echo empty($plugin_com_set['levelname'])?'普通等级':$plugin_com_set['levelname']}  {/if}&nbsp;&nbsp;
                            {loop $agentlevels $level}
                                {if  !empty($limitagentlevels)&&in_array( $level['id'] , $limitagentlevels)}
                                    {php echo $level['levelname']}&nbsp;&nbsp;
                                {/if}
                            {/loop}
                        {/if}
                    </div>
                </div>
            {/if}

            <!--是否开启超级股东-->
            {if $hasglobonus}
                <div class="form-group" >
                    <label  class="col-lg control-label">股东等级</label>
                    <div class="col-sm-8 col-xs-12">
                        {ife 'sale.coupon' $item}
                            <label class="checkbox-inline"><input type="checkbox"  class="checkall" name="limitpartnerlevels[]" value="0" {if !empty($limitpartnerlevels)&&in_array("0",$limitpartnerlevels)} checked="true"  {/if}  /> {php echo empty($plugin_globonus_set['levelname'])?'普通等级':$plugin_globonus_set['levelname']}</label>
                            {loop $partnerlevels $level}
                                <label class="checkbox-inline"><input type="checkbox"  class="checkall" name="limitpartnerlevels[]" value="{$level['id']}"  {if  !empty($limitpartnerlevels)&&in_array( $level['id'] , $limitpartnerlevels)} checked="true"  {/if}  /> {$level['levelname']}</label>
                            {/loop}
                        {else}
                            {if !empty($limitpartnerlevels)&&in_array("0",$limitpartnerlevels)} {php echo empty($plugin_globonus_set['levelname'])?'普通等级':$plugin_globonus_set['levelname']}  {/if}&nbsp;&nbsp;
                            {loop $partnerlevels $level}
                                {if  !empty($limitpartnerlevels)&&in_array( $level['id'] , $limitpartnerlevels)}
                                    {php echo $level['levelname']}&nbsp;&nbsp;
                                {/if}
                            {/loop}
                        {/if}
                    </div>
                </div>
            {/if}

            <!--是否开启区域代理-->
            {if $hasabonus}
                <div class="form-group" >
                    <label  class="col-lg control-label">区域代理等级</label>
                    <div class="col-sm-8 col-xs-12">
                        {ife 'sale.coupon' $item}
                            <label class="checkbox-inline"><input type="checkbox"  class="checkall"  name="limitaagentlevels[]" value="0" {if !empty($limitaagentlevels)&&in_array("0",$limitaagentlevels)} checked="true"  {/if}  /> {php echo empty($plugin_abonus_set['levelname'])?'普通等级':$plugin_abonus_set['levelname']}</label>
                            {loop $aagentlevels $level}
                                <label class="checkbox-inline"><input type="checkbox"   class="checkall" name="limitaagentlevels[]" value="{$level['id']}"  {if !empty($limitaagentlevels)&&in_array( $level['id'] , $limitaagentlevels)} checked="true"  {/if}  /> {$level['levelname']}</label>
                            {/loop}
                        {else}
                        {if  !empty($limitaagentlevels)&&in_array("0",$limitaagentlevels)} {php echo empty($plugin_abonus_set['levelname'])?'普通等级':$plugin_abonus_set['levelname']}  {/if}&nbsp;&nbsp;
                            {loop $aagentlevels $level}
                                {if   !empty($limitaagentlevels)&&in_array( $level['id'] , $limitaagentlevels)}
                                    {php echo $level['levelname']}&nbsp;&nbsp;
                                {/if}
                            {/loop}
                        {/if}
                    </div>
                </div>
            {/if}
        </div>
    </div>
</div>

<script language='javascript'>
    $("#btnCheckAll").bind("click", function () {
        $(".checkall").prop("checked",true);
    });

    $("#btnCheckNone").bind("click", function () {
        $(".checkall").prop("checked",false);
    });


</script>